#ifndef FOC_H
#define FOC_H

void setPWM(float Ua, float Ub, float Uc);
float setTorque(float Uq, float angle_el);
float _normalizeAngle(float angle);
void FOC_Vbus(float power_supply);
void FOC_alignSensor(int _PP, int _DIR);

float serial_motor_target();
String serialReceiveUserCommand();

//传感器读取
float FOC_M0_Velocity();
float FOC_M0_Angle();

// PID
void FOC_M0_SET_ANGLE_PID(float P = 0,float I = 0,float D = 0,float ramp = 0);
void FOC_M0_SET_VEL_PID(float P = 0,float I = 0,float D = 0,float ramp = 0);
void FOC_M0_VEL_PID(float error);
void FOC_M0_ANGLE_PID(float error);

// 接口函数
void FOC_M0_set_Velocity_Angle(float Target);
void FOC_M0_setVelocity(float Target);
void FOC_M0_set_Force_Angle(float Target);
void FOC_M0_setTorque(float Target);

#endif 